﻿using UnityEngine;
using System.Collections;

namespace Room
{
    public class RCAIUnionActorAttack : RCAIUnionActorBase
    {
        GameObject obj = null;
        protected override void OnEnter()
        {
            controller.owner.PlayAnim(AniName.STAND_FIGHT);
            if (obj == null)
            {
                obj = controller.Spawn(RoomUnionFight.ATTACK);
                obj.transform.localPosition = new Vector3(0, 2, 0);
            }
            else
            {
                obj.SetActive(true);
            }
            if (controller.owner.name == StaticData.playerData.playerId.ToString())
            {
                EasyTouchTool.Instance.Hide(); 
            }
        }

        protected override void OnTick()
        {
            controller.owner.move.StopMove();
        }

        protected override void OnLeave()
        {
            controller.Unspawn(obj);
            obj = null;
            if (controller.owner.name == StaticData.playerData.playerId.ToString())
            {
                EasyTouchTool.Instance.ShowJoystick();
            }
        }
    }
}